///*
// *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
// *
// *  Redistribution and use in source and binary forms, with or without
// *  modification, are permitted provided that the following conditions are met:
// *
// *  Redistributions of source code must retain the above copyright notice,
// *  this list of conditions and the following disclaimer.
// *  Redistributions in binary form must reproduce the above copyright
// *  notice, this list of conditions and the following disclaimer in the
// *  documentation and/or other materials provided with the distribution.
// *  Neither the name of the dreamlu.net developer nor the names of its
// *  contributors may be used to endorse or promote products derived from
// *  this software without specific prior written permission.
// *  Author: Chill 庄骞 (smallchill@163.com)
// */
//package com.plian.system.service.fr.vehicle.impl;
//
//import com.alibaba.fastjson.JSONObject;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.itextpdf.text.pdf.AcroFields;
//import com.itextpdf.text.pdf.BaseFont;
//import com.itextpdf.text.pdf.PdfReader;
//import com.itextpdf.text.pdf.PdfStamper;
//import com.plian.Tools.*;
//import com.plian.Tools.pagedata.PageData;
//import com.plian.system.constant.baseinfo.ValueSetConstant;
//import com.plian.system.constant.sys.FormStatusConstant;
//import com.plian.system.constant.sys.FormTypeConstant;
//import com.plian.system.dao.sys.orgzation.OrgzationDao;
//import com.plian.system.dto.fr.vehicle.PurchaseSummaryDTO;
//import com.plian.system.entity.fr.vehicle.VehicleInfo;
//import com.plian.system.entity.fr.vehicle.VehicleScrap;
//import com.plian.system.entity.fr.vehicle.VehicleUpdate;
//import com.plian.system.enumeratea.CarStatus;
//import com.plian.system.mapper.fr.vehicle.VehicleUpdateMapper;
//import com.plian.system.model.CommonCode;
//import com.plian.system.model.ObjResult;
//import com.plian.system.model.page.Page;
//import com.plian.system.mybatis.base.BaseFlowService;
//import com.plian.system.mybatis.base.BaseServiceImpl;
//import com.plian.system.mybatis.search.SearchEntity;
//import com.plian.system.mybatis.search.SearchParamEntiy;
//import com.plian.system.mybatis.support.Condition;
//import com.plian.system.service.bt.baseinfo.BaseInfoService;
//import com.plian.system.service.fr.vehicle.IVehicleInfoService;
//import com.plian.system.service.fr.vehicle.IVehicleScrapService;
//import com.plian.system.service.fr.vehicle.IVehicleUpdateService;
//import com.plian.system.service.sys.code.IFormCodeService;
//import com.plian.system.service.sys.orgzation.OrgzationService;
//import com.plian.system.service.wf.FormWorkflowService;
//import com.plian.system.vo.fr.vehicle.PurchaseSummaryVO;
//import com.plian.system.vo.fr.vehicle.VehicleUpdateVO;
//import com.plian.system.vo.report.HeaderVO;
//import com.plian.system.vo.report.ReportReturnVO;
//import com.plian.system.vo.report.ReportVO;
//import com.plian.system.wrapper.fr.veihicle.VehicleUpdateWrapper;
//import lombok.AllArgsConstructor;
//import org.apache.commons.io.FileUtils;
//import org.apache.commons.io.IOUtils;
//import org.apache.commons.lang.exception.ExceptionUtils;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.core.io.DefaultResourceLoader;
//import org.springframework.core.io.ResourceLoader;
//import org.springframework.stereotype.Service;
//import org.springframework.transaction.annotation.Transactional;
//
//import java.io.*;
//import java.math.BigDecimal;
//import java.text.SimpleDateFormat;
//import java.util.*;
//import java.util.stream.Collectors;
//
//import static com.plian.system.constant.sys.FormStatusConstant.UNREVIEWED;
//
///**
// * 车辆购置更新管理 服务实现类
// *
// * @author jianglei
// * @since 2019-09-26
// */
//@Service
//@AllArgsConstructor
//public class VehicleUpdateServiceImpl extends BaseServiceImpl<VehicleUpdateMapper, VehicleUpdate> implements IVehicleUpdateService, BaseFlowService {
//
//
//	private IVehicleInfoService vehicleInfoService;
//
//	private IVehicleScrapService vehicleScrapService;
//
//	private VehicleUpdateMapper vehicleUpdateMapper;
//
//	private OrgzationService orgzationService;
//
//	private OrgzationDao orgzationDao;
//
//	private BaseInfoService baseInfoService;
//
//	private FormWorkflowService formWorkflowService;
//
//	private IFormCodeService formCodeService;
//
//	private VehicleUpdateWrapper vehicleUpdateWrapper;
//
//	/**
//	 * 多表分页查询
//	 * @param pd
//	 * @return
//	 */
//	@Override
//	public List<PageData> listPage(PageData pd){
//		Page page=new Page(true,pd);
//		return vehicleUpdateMapper.listPage(page);
//	}
//
//	@Override
//    public boolean saveOrUpdate(VehicleUpdate vehicleUpdate) {
//		if (vehicleUpdate.getId() == null){
//			vehicleUpdate.setVersion("1");
//			vehicleUpdate.setCode(formCodeService.getCode(FormTypeConstant.FR_VEHICLEUPDATE_FORM));
//			vehicleUpdate.setFormType(String.valueOf(FormTypeConstant.FR_VEHICLEUPDATE_FORM));
//		}
//        return super.saveOrUpdate(vehicleUpdate);
//    }
//
//    @Override
//    public boolean deleteLogic(List<Long> ids) {
//		for (Long id : ids) {
//			VehicleUpdate vehicleUpdate = getById(id);
//			if (vehicleUpdate == null) {
//				return false;
//			} else if (vehicleUpdate.getStatus() != null &&
//					(vehicleUpdate.getStatus() != FormStatusConstant.STASH && vehicleUpdate.getStatus() != FormStatusConstant.UNREVIEWED)) {
//				return false;
//			}
//			formWorkflowService.deleteProcessInstance(String.valueOf(id));
//		}
//		boolean result = super.deleteLogic(ids);
//		vehicleInfoService.deleteLogicByUpdateId(ids);
//		vehicleScrapService.deleteLogicByUpdateId(ids);
//		return result;
//    }
//
//    @Override
//    public HashMap<String,Object> commit(String id) {
//        handleStatus(Long.valueOf(id), FormStatusConstant.FLOW);
//
//		//将需要提交的流程变量返回，用于工作流侧
//		return new HashMap<String,Object>();
//    }
//
//    @Override
//    public Boolean finish(String id) {
//
//		/**
//		 * 更新新增车辆的状态 车牌号为空的不处理
//		 */
//		QueryWrapper<VehicleInfo> queryWrapper = new QueryWrapper<>();
//		queryWrapper.eq("vehicle_update_id", id);
//		List<VehicleInfo> vehicleInfos = vehicleInfoService.list(queryWrapper);
//		if (CollectionUtil.isNotEmpty(vehicleInfos)){
//			vehicleInfoService.updateStatus(vehicleInfos.stream().filter(vehicleInfo ->
//				StringUtil.isNotBlank(vehicleInfo.getNumberPlate())).map(VehicleInfo::getId).collect(Collectors.toList()), CarStatus.USING.getStatus());
//		}
//
//		/**
//		 * 更新报废车辆状态
//		 */
//		QueryWrapper<VehicleScrap> vehicleUpdateQuery = new QueryWrapper<>();
//		vehicleUpdateQuery.eq("vehicle_update_id", id);
//		List<VehicleScrap> vehicleScraps = vehicleScrapService.list(vehicleUpdateQuery);
//		if (CollectionUtil.isNotEmpty(vehicleScraps)){
//			vehicleInfoService.updateStatus(vehicleScraps.stream().map(VehicleScrap::getVehicleInfoId).collect(Collectors.toList()), CarStatus.SCRAP.getStatus());
//		}
//		return handleStatus(Long.valueOf(id), FormStatusConstant.FINISH);
//    }
//
//    @Override
//    public Boolean reject(String id, int formState, String comment) {
//        return handleStatus(Long.valueOf(id), formState);
//    }
//
//    public void cancel(Long id) {
//		List<Long> vehicleInfoIds = new ArrayList<>();
//
//		VehicleInfo vehicleInfo = new VehicleInfo();
//		vehicleInfo.setVehicleUpdateId(id);
//		List<VehicleInfo> vehicleInfos = vehicleInfoService.list(Condition.getQueryWrapper(vehicleInfo));
//		if (CollectionUtil.isNotEmpty(vehicleInfos)){
//			vehicleInfoIds.addAll(vehicleInfos.stream().map(VehicleInfo::getId).collect(Collectors.toList()));
//		}
//
//		VehicleScrap vehicleScrap = new VehicleScrap();
//		vehicleScrap.setVehicleUpdateId(id);
//		List<VehicleScrap> vehicleScraps = vehicleScrapService.list(Condition.getQueryWrapper(vehicleScrap));
//		if (CollectionUtil.isNotEmpty(vehicleScraps)){
//			vehicleInfoIds.addAll(vehicleScraps.stream().map(VehicleScrap::getVehicleInfoId).collect(Collectors.toList()));
//		}
//
//		vehicleInfoService.updateStatus(vehicleInfoIds, CarStatus.AUDIT.getStatus());
//    }
//
//	@Override
//	@Transactional(rollbackFor=RuntimeException.class)
//	public Boolean submit(VehicleUpdate vehicleUpdate, int type) {
//		if (!Optional.ofNullable(vehicleUpdate.getStatus()).isPresent()){
//			vehicleUpdate.setStatus(FormStatusConstant.UNREVIEWED);
//		}
//
//		boolean result = saveOrUpdate(vehicleUpdate);
//
//		/**
//		 * 原有车辆更新报废处置
//		 */
//		List<VehicleScrap> vehicleScraps = vehicleUpdate.getVehicleScraps();
//		if (CollectionUtil.isNotEmpty(vehicleScraps)) {
//
//			/**
//			 * 删除报废车辆信息
//			 */
//			List<Long> delIds = vehicleScraps.stream().filter(vehicleScrap ->
//				Optional.ofNullable(vehicleScrap.getIsDeleted()).isPresent() && vehicleScrap.getIsDeleted() == 1)
//				.map(VehicleScrap::getId).collect(Collectors.toList());
//			if (CollectionUtil.isNotEmpty(delIds)){
//				vehicleScrapService.deleteLogic(delIds);
//			}
//
//			Map<String, VehicleInfo> infoMap = vehicleInfoService.getVehicleInfoMap();
//			/**
//			 * 剔除车牌重复的数据 和删除的数据
//			 */
//
//			vehicleScraps.removeIf(vehicleScrap -> (Optional.ofNullable(vehicleScrap.getIsDeleted()).isPresent() && vehicleScrap.getIsDeleted() == 1));
//			if (!(vehicleUpdate.getStatus() == FormStatusConstant.STASH)){
//				vehicleScraps = vehicleScraps.stream().filter(vehicleScrap -> StringUtil.isNotBlank(vehicleScrap.getNumberPlate()))
//						.collect(Collectors.collectingAndThen(Collectors.toCollection(()
//								-> new TreeSet<>(Comparator.comparing(vehicleScrap
//								-> vehicleScrap.getNumberPlate()))), ArrayList::new));
//			}
//
//
//			/**
//			 * 给新增数据赋值
//			 */
//			vehicleScraps.stream().forEach(vehicleScrap -> {
//
//					// 根据车牌号设置汽车信息id
//					vehicleScrap.setVehicleInfoId(infoMap.get(vehicleScrap.getNumberPlate()).getId());
//					vehicleScrap.setPurchaseDate(infoMap.get(vehicleScrap.getNumberPlate()).getPurchaseDate());
//					if (vehicleScrap.getId() == null){
//						vehicleScrap.setVehicleUpdateId(vehicleUpdate.getId());
//						vehicleScrap.setStatus(1);
//						vehicleScrap.setIsDeleted(0);
//						//todo 用户信息
////						BladeUser user = SecureUtil.getUser();
////						if (user != null) {
////							vehicleScrap.setCreateUser(user.getUserId());
////						}
//
//						Date now = DateUtil.now();
//						vehicleScrap.setCreateTime(now);
//					}
//				});
//
//
//			/**
//			 * 如果为修改 则将原先数据的所有报废车辆状态先置为2
//			 */
//			if (Optional.ofNullable(vehicleUpdate.getId()).isPresent()){
//				QueryWrapper<VehicleScrap> queryWrapper = new QueryWrapper<>();
//				queryWrapper.eq("vehicle_update_id", vehicleUpdate.getId());
//				List<VehicleScrap> originals = vehicleScrapService.list(queryWrapper);
//				vehicleInfoService.updateStatus(originals.stream().map(VehicleScrap::getVehicleInfoId).collect(Collectors.toList()), CarStatus.USING.getStatus());
//			}
//			if (CollectionUtil.isNotEmpty(vehicleScraps)) {
//				vehicleScrapService.saveOrUpdateBatch(vehicleScraps);
//				if (vehicleUpdate.getStatus() != FormStatusConstant.STASH){
//					if(type == 1){
//						vehicleInfoService.updateStatus(vehicleScraps.stream().map(VehicleScrap::getVehicleInfoId).collect(Collectors.toList()), CarStatus.AUDIT.getStatus());
//					}else {
//						vehicleInfoService.updateStatus(vehicleScraps.stream().map(VehicleScrap::getVehicleInfoId).collect(Collectors.toList()), CarStatus.SCRAP.getStatus());
//					}
//				}
//			}
//		}
//
//		/**
//		 * 车辆信息
//		 */
//		List<VehicleInfo> vehicleInfos = vehicleUpdate.getVehicleInfos();
//		if (CollectionUtil.isNotEmpty(vehicleInfos)){
//
//			/**
//			 * 删除车辆信息
//			 */
//			List<Long> delIds = vehicleInfos.stream().filter(vehicleInfo ->
//				Optional.ofNullable(vehicleInfo.getIsDeleted()).isPresent() && vehicleInfo.getIsDeleted() == 1)
//				.map(VehicleInfo::getId).collect(Collectors.toList());
//			if (CollectionUtil.isNotEmpty(delIds)){
//				vehicleInfoService.deleteLogic(delIds);
//			}
//
//			/**
//			 * 车牌号为空的特殊处理
//			 */
//			List<VehicleInfo> finalVehicleInfo = vehicleInfos.stream().filter(vehicleInfo ->
//				StringUtil.isBlank(vehicleInfo.getNumberPlate())).collect(Collectors.toList());
//
//			/**
//			 * 剔除车牌重复的数据
//			 */
//			finalVehicleInfo.addAll(vehicleInfos.stream().filter(vehicleInfo -> StringUtil.isNotBlank(vehicleInfo.getNumberPlate()))
//				.collect(Collectors.collectingAndThen(Collectors.toCollection(()
//				-> new TreeSet<>(Comparator.comparing(vehicleInfo
//				-> vehicleInfo.getNumberPlate()))), ArrayList::new)));
//            finalVehicleInfo.removeIf(vehicleInfo -> (Optional.ofNullable(vehicleInfo.getIsDeleted()).isPresent() && vehicleInfo.getIsDeleted() == 1));
//
//
//			/**
//			 * 给新增数据赋值
//			 */
//			finalVehicleInfo.stream().filter(vehicleInfo -> vehicleInfo.getId() == null)
//				.forEach(vehicleInfo -> {
//					vehicleInfo.setVehicleUpdateId(vehicleUpdate.getId());
//					vehicleInfo.setIsDeleted(0);
//                    vehicleInfo.setCreateUser(TokenUtil.getTokenUserId());
//					Date now = DateUtil.now();
//					vehicleInfo.setCreateTime(now);
//			});
//
//			/**
//			 * 将报废id赋予新增车辆的def18
//			 */
//			for (VehicleInfo vehicleInfo : finalVehicleInfo){
//				if (vehicleUpdate.getStatus() == FormStatusConstant.STASH){
//					vehicleInfo.setStatus(CarStatus.STASH.getStatus());
//				}else {
//					if (type == 1){
//						vehicleInfo.setStatus(CarStatus.AUDIT.getStatus());
//					}else {
//						vehicleInfo.setStatus(CarStatus.USING.getStatus());
//					}
//				}
//
//				if (StringUtil.isNotBlank(vehicleInfo.getScrapNumberPlate())){
//					for (VehicleScrap vehicleScrap : vehicleScraps){
//						if (vehicleInfo.getScrapNumberPlate().equals(vehicleScrap.getNumberPlate())){
//							vehicleInfo.setDef18(vehicleScrap.getId());
//						}
//					}
//				}
//			}
//
//
//			if (CollectionUtil.isNotEmpty(finalVehicleInfo)) {
//				vehicleInfoService.saveOrUpdateBatch(finalVehicleInfo);
//			}
//
//			HashMap<String, Object> processVariable = new HashMap<>();
//			formWorkflowService.startProcessAndSimulate(String.valueOf(vehicleUpdate.getId()),vehicleUpdate.getFormType(),processVariable);
//		}
//		return result;
//	}
//
//	/**
//     * 统一处理状态机事件方法
//     * @param id 主键
//     * @param updateStatus 更新状态
//     * @return boolean
//     */
//    private Boolean handleStatus(Long id, int updateStatus) {
//        try {
//            VehicleUpdate vehicleUpdate = getById(id);
//			/**
//			 * 设置审批人和审批时间
//			 */
//			if (updateStatus == FormStatusConstant.FINISH){
//				vehicleUpdate.setApprovedUser(TokenUtil.getTokenUserId());
//				Date now = DateUtil.now();
//				vehicleUpdate.setApprovedTime(now);
//			}
//
//			vehicleUpdate.setStatus(updateStatus);
//            updateById(vehicleUpdate);
//            return true;
//        } catch (Exception e) {
//            log.error(ExceptionUtils.getFullStackTrace(e));
//            return false;
//        }
//    }
//
//	@Override
//	public Boolean checkIsExisted(Long id ,String code, String stateApprovalCode) {
//
//		boolean result = true;
//		if (Optional.ofNullable(code).isPresent()) {
//			VehicleUpdate vehicleUpdate = new VehicleUpdate();
//			vehicleUpdate.setCode(code);
//			if (Optional.ofNullable(getOne(Condition.getQueryWrapper(vehicleUpdate))).isPresent()) {
//				if (id==null || !id.equals(getOne(Condition.getQueryWrapper(vehicleUpdate)).getId())){
//					result =  false;
//				}
//			}
//		}
//		if (Optional.ofNullable(stateApprovalCode).isPresent()) {
//			VehicleUpdate vehicleUpdate = new VehicleUpdate();
//			vehicleUpdate.setStateApprovalCode(stateApprovalCode);
//			if (Optional.ofNullable(getOne(Condition.getQueryWrapper(vehicleUpdate))).isPresent()) {
//				if(id==null ||!id.equals(getOne(Condition.getQueryWrapper(vehicleUpdate)).getId())){
//					result =  false;
//				}
//			}
//		}
//		return result ;
//	}
//
//
//
//	@Override
//	public ReportReturnVO purchaseSummary(PurchaseSummaryDTO purchaseSummaryDTO) throws Exception{
//
////		/**
////		 * 获取所以下级单位
////		 */
////		if (Optional.ofNullable(purchaseSummaryDTO).isPresent() && Optional.ofNullable(purchaseSummaryDTO.getApplyCompanyId()).isPresent()){
////			List<String> companyIds = new ArrayList<>();
////
////			List<PageData> orgs = orgzationService.getChlidList(purchaseSummaryDTO.getApplyCompanyId());
////			companyIds.add(purchaseSummaryDTO.getApplyCompanyId());
////			if (CollectionUtil.isNotEmpty(orgs)){
////				for (PageData pd : orgs){
////					companyIds.add((String)pd.get("id"));
////				}
////				purchaseSummaryDTO.setApplyCompanyIds(companyIds);
////			}
////		}
//
//		List<PurchaseSummaryVO> purchaseSummaryVOS = vehicleUpdateMapper.purchaseSummary(purchaseSummaryDTO);
//		List<PurchaseSummaryVO> data = new ArrayList<>();
//		if (CollectionUtil.isNotEmpty(purchaseSummaryVOS)){
//			Map<String, String> vehicleInfoMap = baseInfoService.getChildMap(ValueSetConstant.VEHICLE_INFO);
//
//			purchaseSummaryVOS.forEach(purchaseSummaryVO -> {
//					PageData org = orgzationService.getCompanyNameById(purchaseSummaryVO.getApplyCompanyId());
//					if(org!=null){
//						purchaseSummaryVO.setApplyCompanyName(org.getString("name"));
//					}
//
//					if (StringUtil.isNotBlank(purchaseSummaryVO.getCarModelId()) && vehicleInfoMap.containsKey(purchaseSummaryVO.getCarModelId())){
//						purchaseSummaryVO.setCarModelName(vehicleInfoMap.get(purchaseSummaryVO.getCarModelId()));
//					}
//					if (StringUtil.isNotBlank(purchaseSummaryVO.getApplicationId()) && vehicleInfoMap.containsKey(purchaseSummaryVO.getApplicationId())){
//						purchaseSummaryVO.setApplicationName(vehicleInfoMap.get(purchaseSummaryVO.getApplicationId()));
//					}
//					if (StringUtil.isNotBlank(purchaseSummaryVO.getDisposalMethodId()) && vehicleInfoMap.containsKey(purchaseSummaryVO.getDisposalMethodId())) {
//						purchaseSummaryVO.setDisposalMethodName(vehicleInfoMap.get(purchaseSummaryVO.getDisposalMethodId()));
//					}
//				}
//			);
//
//			List<PageData> allOrgs =  orgzationDao.list(null);
//			Map<String, List<PurchaseSummaryVO>> map = purchaseSummaryVOS.stream().collect(Collectors.groupingBy(PurchaseSummaryVO::getApplyCompanyId));
//
//			int sum = 0;
//			for (PageData org : allOrgs){
//				if (map.containsKey(org.get("id"))){
//					data.addAll(map.get(org.get("id")));
//					sum += map.get(org.get("id")).size();
//					PurchaseSummaryVO vo = new PurchaseSummaryVO();
//					vo.setApplyCompanyName("小计：" + map.get(org.get("id")).size());
//					vo.setDisposalPrice(map.get(org.get("id")).stream().filter(purchaseSummaryVO -> purchaseSummaryVO.getDisposalPrice() != null)
//						.map(PurchaseSummaryVO::getDisposalPrice).reduce(BigDecimal.ZERO, BigDecimal::add));
//					data.add(vo);
//				}
//			}
//			PurchaseSummaryVO end = new PurchaseSummaryVO();
//			end.setApplyCompanyName("总计：" + sum);
//			end.setDisposalPrice(data.stream().filter(purchaseSummaryVO -> "小计".equals(purchaseSummaryVO.getApplyCompanyName()))
//				.map(PurchaseSummaryVO::getDisposalPrice).reduce(BigDecimal.ZERO, BigDecimal::add));
//			data.add(end);
//		}
//
//		ReportReturnVO reportReturnVO = new ReportReturnVO();
//
//		ReportVO reportVO = new ReportVO();
//
//		reportVO
//			.addHeader(HeaderVO.builder().key("applyCompanyName").title("申请单位").build())
//			.addHeader(HeaderVO.builder().key("stateApprovalCode").title("国资审批号").build())
//			.addHeader(HeaderVO.builder().key("carModelName").title("新车车型").build())
//			.addHeader(HeaderVO.builder().key("annualBudgetIndicator").title("年度预算控制指标").build())
//			.addHeader(HeaderVO.builder().key("bareCarPrice").title("裸车单价（万元）").build())
//			.addHeader(HeaderVO.builder().key("applicationName").title("用途").build())
//			.addHeader(HeaderVO.builder().key("numberPlate").title("原车辆车牌号").build())
//			.addHeader(HeaderVO.builder().key("disposalMethodName").title("处置方式").build())
//			.addHeader(HeaderVO.builder().key("disposalPrice").title("处置价格").build())
//			.addHeader(HeaderVO.builder().key("contact").title("企业联系人").build())
//			.addHeader(HeaderVO.builder().key("contactNumber").title("联系电话").build());
//		reportVO.setData(data);
//		reportReturnVO.setGrids(reportVO);
//		return reportReturnVO;
//	}
//
//	@Override
//	public Boolean checkCancel(Long id, List<VehicleInfo> list) {
//		VehicleUpdate vehicleUpdate = getById(id);
//
//		VehicleInfo vehicleInfo = new VehicleInfo();
//		vehicleInfo.setVehicleUpdateId(vehicleUpdate.getId());
//		List<VehicleInfo> vehicleInfos = vehicleInfoService.list(Condition.getQueryWrapper(vehicleInfo));
//
//		if (CollectionUtil.isNotEmpty(vehicleInfos)){
//			for (VehicleInfo v : vehicleInfos){
//				if (StringUtil.isNotBlank(v.getNumberPlate()) && v.getStatus() != CarStatus.USING.getStatus()){
//					for(VehicleInfo newlist : list){
//						if(newlist.getNumberPlate().equals(v.getNumberPlate()) && !newlist.getId().equals(v.getId())){
//							return false;
//						}
//					}
//				}
//			}
//		}
//    	return true;
//	}
//
//	@Override
//	public ObjResult change(VehicleUpdate vehicleUpdate) {
//		ObjResult objResult;
//
//		VehicleUpdate old= getById(vehicleUpdate.getId());
//		VehicleInfo vehicleInfo = new VehicleInfo();
//		vehicleInfo.setVehicleUpdateId(old.getId());
//		old.setVehicleInfos(vehicleInfoService.list(Condition.getQueryWrapper(vehicleInfo)));
//
//		VehicleScrap vehicleScrap = new VehicleScrap();
//		vehicleScrap.setVehicleUpdateId(old.getId());
//		old.setVehicleScraps(vehicleScrapService.list(Condition.getQueryWrapper(vehicleScrap)));
//		if (CollectionUtil.isNotEmpty(old.getVehicleScraps())){
//			vehicleInfoService.updateStatus(old.getVehicleScraps()
//				.stream().map(VehicleScrap::getVehicleInfoId).collect(Collectors.toList()), CarStatus.USING.getStatus());
//		}
//		String message = checkSubmit(vehicleUpdate);
//		if (Optional.ofNullable(message).isPresent()){
//			if (CollectionUtil.isNotEmpty(old.getVehicleScraps())){
//				vehicleInfoService.updateStatus(old.getVehicleScraps()
//					.stream().map(VehicleScrap::getVehicleInfoId).collect(Collectors.toList()), CarStatus.SCRAP.getStatus());
//			}
//			objResult = new ObjResult(CommonCode.FAIL);
//			PageData pd = new PageData();
//			pd.put("message", message);
//			objResult.setPageData(pd);
//			return objResult;
//		}
//
//		//snapshotClient.push("vehicleUpdate",vehicleUpdate.getId(),jsonObject);
//		//vehicleUpdate.setStatus(BillStatus.INIT.billStatus());
//		vehicleUpdate.setVersion(StringUtil.isBlank(vehicleUpdate.getVersion()) ?
//			"1" : String.valueOf(Integer.valueOf(vehicleUpdate.getVersion())+1));
//
//		if (submit(vehicleUpdate, 2)){
//			objResult = new ObjResult(CommonCode.SUCCESS);
//		}else {
//			objResult = new ObjResult(CommonCode.FAIL);
//		}
//		return objResult;
//	}
//
//
//	@Override
//	public String checkSubmit(VehicleUpdate vehicleUpdate) {
//		List<VehicleScrap> vehicleScraps = vehicleUpdate.getVehicleScraps();
//		/*if (!StringUtil.isEmpty(vehicleUpdate.getCode())&&!this.checkIsExisted(vehicleUpdate.getId(), vehicleUpdate.getCode(), vehicleUpdate.getStateApprovalCode())) {
//			return R.fail("单据编号或国资审批号已存在");
//		}*/
//		List<VehicleInfo> vehicleInfos = vehicleUpdate.getVehicleInfos();
//		if (CollectionUtil.isNotEmpty(vehicleInfos)){
//			List<String> oldNumberPlates = new ArrayList<>();
//			if (vehicleUpdate.getId() != null){
//				QueryWrapper<VehicleInfo> queryWrapper = new QueryWrapper<>();
//				queryWrapper.eq("vehicle_update_id", vehicleUpdate.getId());
//				oldNumberPlates.addAll(vehicleInfoService.list(queryWrapper).stream().map(VehicleInfo::getNumberPlate).collect(Collectors.toList()));
//			}
//			oldNumberPlates.addAll(vehicleScraps.stream().map(VehicleScrap::getNumberPlate).collect(Collectors.toList()));
//			for (VehicleInfo vehicleInfo : vehicleInfos){
//				if (!(Optional.ofNullable(vehicleInfo.getIsDeleted()).isPresent() && vehicleInfo.getIsDeleted() == 1)){
//					if (!vehicleInfoService.checkIsExisted(oldNumberPlates, vehicleInfo.getNumberPlate())){
//						return "新增车辆车牌号" + vehicleInfo.getNumberPlate() + "已经存在";
//					}
//				}
//			}
//		}
//		if (CollectionUtil.isNotEmpty(vehicleScraps)){
//			Map<String, VehicleInfo> infoMap = vehicleInfoService.getVehicleInfoMap();
//			List<String> oldScrapNumberPlates = new ArrayList<>();
//			if (vehicleUpdate.getId() != null){
//				QueryWrapper<VehicleScrap> queryWrapper = new QueryWrapper<>();
//				queryWrapper.eq("vehicle_update_id", vehicleUpdate.getId());
//				oldScrapNumberPlates.addAll(vehicleScrapService.list(queryWrapper).stream().map(VehicleScrap::getNumberPlate).collect(Collectors.toList()));
//			}
//
//			for (VehicleScrap vehicleScrap : vehicleScraps){
//				if (!(Optional.ofNullable(vehicleScrap.getIsDeleted()).isPresent() && vehicleScrap.getIsDeleted() == 1)) {
//					if (StringUtil.isBlank(vehicleScrap.getNumberPlate())) {
//						return "报废车辆车牌号不能为空";
//					}
//					if (!infoMap.containsKey(vehicleScrap.getNumberPlate())) {
//						return "车牌号" + vehicleScrap.getNumberPlate() + "不存在";
//					}
//					if (!vehicleScrapService.checkIsExisted(oldScrapNumberPlates, vehicleScrap.getNumberPlate())) {
//						return "车牌号" + vehicleScrap.getNumberPlate() + "不能报废";
//					}
//				}
//			}
//		}
//		return null;
//	}
//	@Override
//	public File buildpdf(Long id) {
//		VehicleUpdateVO bean = vehicleUpdateWrapper.entityToVO(getById(id));
//		VehicleInfo vehicleInfo = new VehicleInfo();
//		vehicleInfo.setVehicleUpdateId(bean.getId());
//		bean.setVehicleInfos(vehicleInfoService.list(Condition.getQueryWrapper(vehicleInfo)));
//
//		VehicleScrap vehicleScrap = new VehicleScrap();
//		vehicleScrap.setVehicleUpdateId(bean.getId());
//		bean.setVehicleScraps(vehicleScrapService.list(Condition.getQueryWrapper(vehicleScrap)));
//
//		Map< String,String > images=new HashMap<>(16);
//		File file = null ;
//
//		try {
//			ResourceLoader resourceLoader = new DefaultResourceLoader();
//			InputStream inputStream = resourceLoader.getResource("/pdf/vehicleupdate.pdf").getInputStream();
//			//通过将文件转换为临时文件进行操作
//			File model = File.createTempFile("model", ".png");
//			try {
//				FileUtils.copyInputStreamToFile(inputStream, model);
//			} finally {
//				//关闭IO
//				IOUtils.closeQuietly(inputStream);
//			}
//			/*InputStream inputStream2 = resourceLoader.getResource("4DB6230D1BF52D9A012171F8493CF278.png").getInputStream();
//			//通过将文件转换为临时文件进行操作
//			File image = File.createTempFile("logoImage1", ".png");
//			try {
//				FileUtils.copyInputStreamToFile(inputStream2, image);
//			} finally {
//				//关闭IO
//				IOUtils.closeQuietly(inputStream2);
//			}
//			images.put("logoImage1",!image.exists()?"":image.getAbsolutePath());
//			images.put("logoImage2",!image.exists()?"":image.getAbsolutePath());
//			images.put("logoImage3",!image.exists()?"":image.getAbsolutePath());
//			images.put("logoImage4",!image.exists()?"":image.getAbsolutePath());*/
//			if (bean!=null&&model.exists()) {
//				Map< String,Object > data = new HashMap<>(16);
//				data.put("stateApprovalCode1",bean.getStateApprovalCode());
//				data.put("applyCompanyName1",bean.getApplyCompanyName());
//				data.put("purchaseUpdateReason1",bean.getPurchaseUpdateReason());
//				data.put("contact1",bean.getContact());
//				data.put("contactNumber1",bean.getContactNumber());
//				data.put("annualBudgetIndicator1",bean.getAnnualBudgetIndicator());
//				data.put("existingCarAmount1",bean.getExistingCarAmount());
//				data.put("stateApprovalCode2",bean.getStateApprovalCode());
//				data.put("applyCompanyName2",bean.getApplyCompanyName());
//				data.put("purchaseUpdateReason2",bean.getPurchaseUpdateReason());
//				data.put("contact2",bean.getContact());
//				data.put("contactNumber2",bean.getContactNumber());
//				data.put("annualBudgetIndicator2",bean.getAnnualBudgetIndicator());
//				data.put("existingCarAmount2",bean.getExistingCarAmount());
//
//
//				List<VehicleScrap> vehicleScraps = bean.getVehicleScraps();
//				Map<String,VehicleScrap> map = new HashMap<>(16);
//				Map<String,VehicleScrap> mapLeft= new HashMap<>(16);
//				if (vehicleScraps!=null) {
//					map = vehicleScraps.stream().collect(Collectors.toMap(VehicleScrap::getNumberPlate, x -> x));
//					mapLeft.putAll(map);
//				}
//				List<VehicleInfo> vehicleInfos = bean.getVehicleInfos();
//				int i=0,j=0;
//				if (vehicleInfos!=null) {
//					for (int x = 0; x < vehicleInfos.size(); x++) {
////						String carModelName = Optional.ofNullable(CarModelCache.getById(vehicleInfos.get(x).getCarModelId())).map(CarModel::getCarModelName).orElse("");
////						String applicationName = Optional.ofNullable(ApplicationCache.getById(vehicleInfos.get(x).getApplicationId())).map(Application::getApplicationName).orElse("");
//						// todo 字典值暂时不处理
//						String applicationName = "业务保障用车";
//						String carModelName = "领导人员";
//						if ("业务保障用车".equals(applicationName)||"班车".equals(applicationName)){
//							data.put("i.id."+i,i+1);
//							data.put("i.def1."+i,vehicleInfos.get(x).getDef1());
//							data.put("i.bareCarPrice."+i,vehicleInfos.get(x).getBareCarPrice());
//							data.put("i.num."+i,1);
//							VehicleScrap temp = map.get(vehicleInfos.get(x).getScrapNumberPlate());
//							if (temp!=null){
//								mapLeft.remove(vehicleInfos.get(x).getScrapNumberPlate());
//								data.put("i.scrapNumberPlate."+i,vehicleInfos.get(x).getScrapNumberPlate());
////								String disposalMethodName = Optional.ofNullable(DisposalMethodCache.getById(temp.getDisposalMethodId())).map(DisposalMethod::getDisposalMethodName).orElse("");
////								data.put("i.disposalMethodName." + i, disposalMethodName);
//							}
//							if ("业务保障用车".equals(applicationName)) {
//								data.put("i.left."+i,"√");
//							} else {
//								data.put("i.right."+i,"√");
//							}
//							i++;
//						}else if ("领导人员".equals(applicationName)||"一般人员".equals(applicationName)){
//							data.put("j.id."+j,j+1);
//							data.put("j.def1."+j,vehicleInfos.get(x).getDef1());
//							data.put("j.bareCarPrice."+j,vehicleInfos.get(x).getBareCarPrice());
//							data.put("j.num."+j,1);
//							VehicleScrap temp = map.get(vehicleInfos.get(x).getScrapNumberPlate());
//							if (temp!=null){
//								mapLeft.remove(vehicleInfos.get(x).getScrapNumberPlate());
//								data.put("j.scrapNumberPlate."+j,vehicleInfos.get(x).getScrapNumberPlate());
////								String disposalMethodName = Optional.ofNullable(DisposalMethodCache.getById(temp.getDisposalMethodId())).map(DisposalMethod::getDisposalMethodName).orElse("");
////								data.put("j.disposalMethodName." + j, disposalMethodName);
//							}
//							if ("领导人员".equals(applicationName)) {
//								data.put("j.left."+j,"√");
//							} else {
//								data.put("j.right."+j,"√");
//							}
//							j++;
//						}
//					}
//				}
//				int other=i;
//				String otherStr="i";
//				if (i==0&&j!=0){
//					other=j;
//					otherStr="j";
//				}
//				for(Map.Entry<String, VehicleScrap> temp: mapLeft.entrySet()){
//					data.put(otherStr+".id."+other,other+1);
//					data.put(otherStr+".scrapNumberPlate."+other,temp.getValue().getNumberPlate());
////					String disposalMethodName = Optional.ofNullable(DisposalMethodCache.getById(temp.getValue().getDisposalMethodId())).map(DisposalMethod::getDisposalMethodName).orElse("");
////					data.put(otherStr+".disposalMethodName." + other, disposalMethodName);
//					other++;
//				}
//
//				String fileName = model.getPath();
//				PdfReader reader = new PdfReader(fileName);
//				ByteArrayOutputStream bos = new ByteArrayOutputStream();
//				/* 将要生成的目标PDF文件名称 */
//				PdfStamper ps = new PdfStamper(reader, bos);
//				/* 使用中文字体 */
//				BaseFont bf = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
//				ArrayList< BaseFont > fontList = new ArrayList <> ();
//				fontList.add(bf);
//
//				/* 取出报表模板中的所有字段 */
//				AcroFields fields = ps.getAcroFields();
//				fields.setSubstitutionFonts(fontList);
//				for (String key: data.keySet()) {
//					if (data.get(key)!=null) {
//						String value = data.get(key).toString();
//						if (data.get(key) instanceof Date) {
//							value = processDate((Date) data.get(key));
//						}
//						fields.setField(key, value);
//					}
//				}
//
//				/*if (images!=null) {
//					for (String key : images.keySet()) {
//						if (!StringUtil.isEmpty(images.get(key))) {
//							//待加入图片的文字域,设置为隐藏;不然会遮挡掉图片的
//							OutPdf.insertImage(fields, ps, key, images.get(key));
//						}
//					}
//				}*/
//				/* 必须要调用这个，否则文档不会生成的 */
//				ps.setFormFlattening(true);
//				ps.close();
//				File dir = new File(model.getParent());
//				String classFullName = bean.getClass().getName();
//				file = File.createTempFile(classFullName.substring(classFullName.lastIndexOf(".")), ".pdf", dir);
//				OutputStream fos = new FileOutputStream(file);
//				fos.write(bos.toByteArray());
//				fos.flush();
//				fos.close();
//				bos.close();
//			}
//
//		} catch(Exception e) {
//			log.error(ExceptionUtils.getFullStackTrace(e));
//		}
//		return file;
//	}
//	private static String processDate(Date date){
//		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
//		return date==null?"":format.format(date);
//	}
//	@Override
//	public File exportExcel(JSONObject jsonObject) {
//		List<SearchEntity> entityList = Optional.ofNullable(jsonObject.getJSONArray("query"))
//			.map(x -> x.toJavaList(SearchEntity.class)).orElse(new ArrayList<>());
//		QueryWrapper<VehicleUpdate> qw = SearchParamEntiy.getQueryWrapper(
//			Condition.getQueryWrapper(new VehicleUpdate()), entityList
//		);
//
//		List<VehicleUpdate> floors = list(qw);
////		return ExcelUtils.exportExcelByList(jsonObject, VehicleUpdateWrapper.build().listVO(floors));
//		return null;
//	}
//
//	@Override
//	public List<PageData> findByIds(List<String> formIds) {
//    	QueryWrapper<VehicleUpdate> queryWrapper = new QueryWrapper<>();
//    	queryWrapper.in("id", Func.toLongList(StringUtils.join(formIds, StringPool.COMMA)));
//    	List<VehicleUpdate> vehicleUpdates = list(queryWrapper);
//		List<VehicleUpdateVO> vehicleUpdateVOS = vehicleUpdateWrapper.entityToVO(vehicleUpdates);
//		List<PageData> pageDataList = new ArrayList<>();
//		try{
//			if (CollectionUtil.isNotEmpty(vehicleUpdateVOS)){
//				for (VehicleUpdateVO vo : vehicleUpdateVOS){
//					PageData pd = new PageData();
//					pd.put("id", vo.getId());
//					pd.put("UNITNAME", vo.getApplyCompanyName());
//					pd.put("APPLICANTNAME", vo.getCreateUserName());
//					pd.put("applicantId", vo.getCreateUser());
//					pd.put("applyOrganizationId", vo.getApplyCompanyId());
//					pd.put("formType", FormTypeConstant.FR_VEHICLEUPDATE_FORM);
//					pd.put("status", vo.getStatus());
//					pd.put("orgName",vo.getApplyCompanyName());
//					pageDataList.add(pd);
//				}
//			}
//
//			return pageDataList;
//		} catch (Exception e) {
//			log.error(ExceptionUtils.getFullStackTrace(e));
//		}
//		return pageDataList;
//	}
//
//	@Override
//	public void goBackToStash(String formId) {
//		cancel(Long.valueOf(formId));
//		handleStatus(Long.valueOf(formId), UNREVIEWED);
//	}
//
//	@Override
//	public List<Integer> getFormType() {
//		return Arrays.asList(FormTypeConstant.FR_VEHICLEUPDATE_FORM);
//	}
//
//	//	@Override
////	@Async("CwjdExecutor")
////	public Future<ImportResult> importExcel(String progressId, InputStream inputStream) {
////		String progress = "progress";
////		String key = progressId + "#" + CacheConstant.HALF_HOUR;
////		//解析数据
////		try {
////			byte[] bytes = IOUtils.toByteArray(inputStream);
////			//读取主表
////			inputStream = new ByteArrayInputStream(bytes);
////			List<Object> updateReadExcels = EasyExcelFactory.read(
////				inputStream, new com.alibaba.excel.metadata.Sheet(2, 1, VehicleUpdateExcel.class)
////			);
////			inputStream.reset();
////			//校验主表
////			ImportResult importResult = check(updateReadExcels);
////			if (!importResult.isSuccess()) {
////				return new AsyncResult<>(importResult);
////			}
////			//读取子表
////			inputStream = new ByteArrayInputStream(bytes);
////			List<Object> carExcels = EasyExcelFactory.read(
////				inputStream, new com.alibaba.excel.metadata.Sheet(4, 1, VehicleInfoExcel.class)
////			);
////			inputStream.reset();
////			//校验子表
////			int size=carExcels.size();
////			ImportResult carResult = checkCarData(carExcels,key);
////			if (!carResult.isSuccess()) {
////				CacheUtil.put(progress, progress, key, carResult.getMsg());
////				return new AsyncResult<>(carResult);
////			}
////
////			//保存主表
////			VehicleUpdateExcel vehicleUpdateExcel = (VehicleUpdateExcel) updateReadExcels.get(0);
////			VehicleUpdate vehicleUpdate = (VehicleUpdate) ImportExcelUtil.getEntityByExcelBean(vehicleUpdateExcel, new VehicleUpdate());
////			vehicleUpdate.setVersion("1");
////			vehicleUpdate.setStatus(3);
////			//留下主键
////			VehicleUpdate vehicleUpdatenew = BeanUtil.copy(vehicleUpdate, VehicleUpdate.class);
////			saveOrUpdate(vehicleUpdatenew);
////			//保存子表
////			int count=0;
////			for (Object readExcel : carExcels) {
////				VehicleInfoExcel vehicleInfoExcel = (VehicleInfoExcel) readExcel;
////				VehicleInfo vehicleInfo = (VehicleInfo) ImportExcelUtil.getEntityByExcelBean(vehicleInfoExcel, new VehicleInfo());
////				vehicleInfo.setVehicleUpdateId(vehicleUpdatenew.getId());
////				//车辆状态2在用
////				vehicleInfo.setStatus(2);
////				//入库
////				try {
////					vehicleInfoService.saveOrUpdate(vehicleInfo);
////					count++;
////					int value = count * 100 / size;
////					log.info("子表进度："+value+100);
////					CacheUtil.put(progress, progress, key, value+100);
////					log.info("子表进度："+value);
////				} catch (Exception e) {
////					log.error(vehicleInfo + "导入失败");
////					CacheUtil.put(progress, progress, key,vehicleInfo + "导入失败");
////					return new AsyncResult<>(new ImportResult(false,vehicleInfo + "导入失败"));
////				}
////			}
////		} catch (Exception e) {
////			log.error(ExceptionUtils.getFullStackTrace(e));
////			log.error("解析失败");
////			CacheUtil.put(progress, progress, key,"解析失败");
////			return new AsyncResult<>(new ImportResult(false,"解析失败"));
////		}
////		CacheUtil.put(progress, progress, key,"导入成功");
////		return new AsyncResult<>(new ImportResult(true,"导入成功"));
////	}
////
////	private ImportResult check(List<Object> readExcels) {
////		Map<String,Map<String,Long>> mapRef= getRef();
////		StringBuilder msg = new StringBuilder();
////		ImportResult importResult = new ImportResult(true, "");
////		if(readExcels.size()>1){
////			msg.append("sheet2车辆购置更新主表数据只能有一条\n");
////			return new ImportResult(false, msg.toString());
////		}
////		VehicleUpdateExcel vehicleUpdateExcel = (VehicleUpdateExcel) readExcels.get(0);
////		//判空
////		msg.append(ImportExcelUtil.checkEmpty("2", "申请购车单位", vehicleUpdateExcel.getApplyCompanyId(), 0).getMsg());
////		msg.append(ImportExcelUtil.checkEmpty("2", "业务类型", vehicleUpdateExcel.getBusinessTypeId(), 0).getMsg());
////		msg.append(ImportExcelUtil.checkEmpty("2", "车辆用途理由", vehicleUpdateExcel.getPurchaseUpdateReason(), 0).getMsg());
////		msg.append(ImportExcelUtil.checkEmpty("2", "现有业务经营保障用车数量", vehicleUpdateExcel.getExistingCarAmount(), 0).getMsg());
////		//判断类型
////		msg.append(ImportExcelUtil.checkType(ImportExcelUtil.TYPE_INTEGER,"2","业务类型",
////			vehicleUpdateExcel.getBusinessTypeId(),0).getMsg());
////		msg.append(ImportExcelUtil.checkType(ImportExcelUtil.TYPE_INTEGER,"2","现有业务经营保障用车数量",
////			vehicleUpdateExcel.getExistingCarAmount(),0).getMsg());
////		msg.append(ImportExcelUtil.checkType(ImportExcelUtil.TYPE_INTEGER,"2","联系电话",
////			vehicleUpdateExcel.getContactNumber(),0).getMsg());
////		//判断完类型若有错直接返回
////		if (msg.toString().length() > 0) {
////			return new ImportResult(false, msg.toString());
////		}
////		//对象和字典是否存在校验
////		if(mapRef.get("UnitRef").containsKey(vehicleUpdateExcel.getApplyCompanyId())){
////			vehicleUpdateExcel.setApplyCompanyId(mapRef.get("UnitRef").get(vehicleUpdateExcel.getApplyCompanyId()).toString());
////		}else if(!StringUtil.isEmpty(vehicleUpdateExcel.getApplyCompanyId())){
////			msg.append(ImportExcelUtil.msgBuilder("2","2","申请购车单位", vehicleUpdateExcel.getApplyCompanyId(), "未找到对应对象!"));
////		}
////		if(mapRef.get("BusinessTypeRef").containsKey(vehicleUpdateExcel.getBusinessTypeId())){
////			vehicleUpdateExcel.setBusinessTypeId(mapRef.get("BusinessTypeRef").get(vehicleUpdateExcel.getBusinessTypeId()).toString());
////		}else if(!StringUtil.isEmpty(vehicleUpdateExcel.getBusinessTypeId())){
////			msg.append(ImportExcelUtil.msgBuilder("2","2","业务类型", vehicleUpdateExcel.getBusinessTypeId(), "未找到对应对象!"));
////		}
////		if (msg.toString().length() > 0) {
////			return new ImportResult(false, msg.toString());
////		}
////		return importResult;
////	}
////	private ImportResult checkCarData(List<Object> readExcels,String progressId) {
////		Map<String,Map<String,Long>> mapRef= getRef();
////		StringBuilder msg = new StringBuilder();
////		ImportResult importResult = new ImportResult(true, "");
////		for (Object readExcel : readExcels) {
////			VehicleInfoExcel vehicleInfoExcel = (VehicleInfoExcel) readExcel;
////			int index = readExcels.indexOf(readExcel);
////			vehicleInfoExcel.setPurchaseDate(vehicleInfoExcel.getPurchaseDate()+"-01");
////			//判空
////			msg.append(ImportExcelUtil.checkEmpty("4", "新购车车牌号", vehicleInfoExcel.getNumberPlate(), index).getMsg());
////			msg.append(ImportExcelUtil.checkEmpty("4", "所属单位", vehicleInfoExcel.getCompanyId(), index).getMsg());
////			msg.append(ImportExcelUtil.checkEmpty("4", "排气量", vehicleInfoExcel.getExhaustVolume(), index).getMsg());
////			msg.append(ImportExcelUtil.checkEmpty("4", "车型", vehicleInfoExcel.getCarModelId(), index).getMsg());
////			msg.append(ImportExcelUtil.checkEmpty("4", "详细车型", vehicleInfoExcel.getDef1(), index).getMsg());
////			msg.append(ImportExcelUtil.checkEmpty("4", "用途", vehicleInfoExcel.getApplicationId(), index).getMsg());
////			//判断类型
////			msg.append(ImportExcelUtil.checkType(ImportExcelUtil.TYPE_BIGDECIMAL,"4","裸车单价",
////				vehicleInfoExcel.getBareCarPrice(),index).getMsg());
////			msg.append(ImportExcelUtil.checkType(ImportExcelUtil.TYPE_DATE,"4","购置时间（年/月）",
////				vehicleInfoExcel.getPurchaseDate(),index).getMsg());
////			msg.append(ImportExcelUtil.checkType(ImportExcelUtil.TYPE_BIGDECIMAL,"4","排气量",
////				vehicleInfoExcel.getExhaustVolume(),index).getMsg());
////			msg.append(ImportExcelUtil.checkType(ImportExcelUtil.TYPE_INTEGER,"4","车型",
////				vehicleInfoExcel.getCarModelId(),index).getMsg());
////			msg.append(ImportExcelUtil.checkType(ImportExcelUtil.TYPE_INTEGER,"4","用途",
////				vehicleInfoExcel.getApplicationId(),index).getMsg());
////			//判重
////			//车牌号是否存在
////			if(mapRef.get("CarRef").containsKey(vehicleInfoExcel.getNumberPlate())){
////				msg.append(ImportExcelUtil.msgBuilder("4",String.valueOf(index + 2),"新购车车牌号", vehicleInfoExcel.getNumberPlate(), "重复!"));
////			}
////			mapRef.get("CarRef").put(vehicleInfoExcel.getNumberPlate(),null);
////		}
////		//判断完类型若有错直接返回
////		if (msg.toString().length() > 0) {
////			return new ImportResult(false, msg.toString());
////		}
////		//对象和字典是否存在校验
////		int size=readExcels.size();
////		int count=0;
////		for (Object readExcel : readExcels) {
////			VehicleInfoExcel vehicleInfoExcel = (VehicleInfoExcel) readExcel;
////			int index = readExcels.indexOf(readExcel);
////			if(mapRef.get("UnitRef").containsKey(vehicleInfoExcel.getCompanyId())){
////				vehicleInfoExcel.setCompanyId(mapRef.get("UnitRef").get(vehicleInfoExcel.getCompanyId()).toString());
////			}else if(!StringUtil.isEmpty(vehicleInfoExcel.getCompanyId())){
////				msg.append(ImportExcelUtil.msgBuilder("4",String.valueOf(index + 2),"所属单位", vehicleInfoExcel.getCompanyId(), "在系统中不存在!"));
////			}
////			if(mapRef.get("CarModelRef").containsKey(vehicleInfoExcel.getCarModelId())){
////				vehicleInfoExcel.setCarModelId(mapRef.get("CarModelRef").get(vehicleInfoExcel.getCarModelId()).toString());
////			}else if(!StringUtil.isEmpty(vehicleInfoExcel.getCarModelId())){
////				msg.append(ImportExcelUtil.msgBuilder("4",String.valueOf(index + 2),"车型", vehicleInfoExcel.getCarModelId(), "在系统中不存在!"));
////			}
////			if(mapRef.get("ApplicationRef").containsKey(vehicleInfoExcel.getApplicationId())){
////				vehicleInfoExcel.setApplicationId(mapRef.get("ApplicationRef").get(vehicleInfoExcel.getApplicationId()).toString());
////			}else if(!StringUtil.isEmpty(vehicleInfoExcel.getApplicationId())){
////				msg.append(ImportExcelUtil.msgBuilder("4",String.valueOf(index + 2),"用途", vehicleInfoExcel.getApplicationId(), "在系统中不存在!"));
////			}
////			count++;
////			int value = count * 100 / size;
////			CacheUtil.put("progress","progress",progressId, value);
////			log.info("校验进度："+value);
////		}
////		if (msg.toString().length() > 0) {
////			importResult = new ImportResult(false, msg.toString());
////		}
////		return importResult;
////	}
////
////	public Map<String,Map<String,Long>> getRef() {
////		Map<String,Map<String,Long>> maprefs = new HashMap<String,Map<String,Long>>(16);
////		Map<String,Long> unitRef = new HashMap<String,Long>(16);
////		for(Unit rank : iUnitClient.list()) {
////			unitRef.put(rank.getName(), rank.getId());
////		}
////		maprefs.put("UnitRef",unitRef);
////
////		Map<String,Long> businessTypeRef = new HashMap<String,Long>(16);
////		for(BusinessType rank : businessTypeClient.list()){
////			businessTypeRef.put(rank.getBusinessTypeCode(),rank.getId());
////		}
////		maprefs.put("BusinessTypeRef",businessTypeRef);
////
////		Map<String,Long> carModelRef = new HashMap<String,Long>(16);
////		for(CarModel rank : carModelClient.list()){
////			carModelRef.put(rank.getCarModelCode(),rank.getId());
////		}
////		maprefs.put("CarModelRef",carModelRef);
////
////		Map<String,Long> applicationRef = new HashMap<String,Long>(16);
////		for(Application rank : applicationClient.list()){
////			applicationRef.put(rank.getApplicationCode(),rank.getId());
////		}
////		maprefs.put("ApplicationRef",applicationRef);
////
////		Map<String,Long> carRef = new HashMap<String,Long>(16);
////		for(VehicleInfo rank : vehicleInfoService.list(Condition.getQueryWrapper(new VehicleInfo()).ne("status", 3))){
////			carRef.put(rank.getNumberPlate(),rank.getId());
////		}
////		maprefs.put("CarRef",carRef);
////    	return maprefs ;
////	}
//
//}
